---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: access-to-cni-istio
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "istio-cni-node")) | nindent 2 }}
rules:
  - apiGroups: ["apps"]
    resources: ["daemonsets/prometheus-metrics"]
    resourceNames: ["istio-cni-node"]
    verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: access-to-cni-istio
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "istio-cni-node")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: access-to-cni-istio
subjects:
  - kind: User
    name: d8-monitoring:scraper
  - kind: ServiceAccount
    name: prometheus
    namespace: d8-monitoring
